import { Body, Controller, Delete, Get, Inject, Query, Post, Put, Req, Headers } from '@nestjs/common';
import { PhotoService } from './photo.service';

@Controller('photo')
export class PhotoController {
  constructor(
    @Inject(PhotoService) private readonly PhotoService: PhotoService,
  ) { }

  // @Get('/:id?/:q?/:user?')
  // async getOnePhoto(@Query() query) {
  //   const data = await this.PhotoService.findOnePhoto(query.id);
  //   return { code: 200, message: '查询成功', data };
  // }

  @Get('/getPhotoList')
  async getPhotoList(@Query() query) {
    console.log(query);
    const data = await this.PhotoService.selectByQuery(query)
    return { code: 200, message: '查询成功', data };
  }

  @Post('/')
  async addPhoto(@Body() body, @Headers() header) {
    console.log(body);
    console.log(header);
    const data = await this.PhotoService.createPhoto(body)
    return { code: 200, message: '查询成功', data };
  }
}
